public class demo7 {
    public static void main(String[] args) {
            Thread t=new Thread(()->{
                while(true){
                    System.out.println("hello run");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            });
            //将t变为后台线程，要设置在start之前
//            t.setDaemon(true);
            t.start();
            for(int i=0;i<3;i++){
                System.out.println("hello main");
            }
    }
}
